﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using MonPocGarage.ArmyContracts.Common.Enums;
using MonPocGarage.ArmyContracts.Common.Stats;
using MonPocGarage.Common.Extensions;

namespace MonPocGarage.ArmyData.Builders
{
    internal static class Mappers
    {
        public static PowerStat MapPowerStat(XmlNode xNode)
        {
            return new PowerStat
                       {
                           ActionDice = Convert.ToInt32(xNode.SelectSingleNode("ActionDice").InnerText),
                           BoostDice = Convert.ToInt32(xNode.SelectSingleNode("BoostDice").InnerText)
                       };
        }

        public static BrawlStat MapBrawlStat(XmlNode xNode)
        {
            return new BrawlStat
                       {
                           ActionDice = Convert.ToInt32(xNode.SelectSingleNode("ActionDice").InnerText),
                           BoostDice = Convert.ToInt32(xNode.SelectSingleNode("BoostDice").InnerText)
                       };
        }

        public static BlastStat MapBlastStat(XmlNode xNode)
        {
            return new BlastStat
                       {
                           ActionDice = Convert.ToInt32(xNode.SelectSingleNode("ActionDice").InnerText),
                           BoostDice = Convert.ToInt32(xNode.SelectSingleNode("BoostDice").InnerText),
                           BlastRange = xNode.SelectSingleNode("BlastRange").InnerText.ToEnumValue<BlastRange>()
                       };
        }
    }
}
